home *** CD-ROM | disk | FTP | other *** search
/ Programming an RTS Game with Direct3D / Programming an RTS Game with Direct3D.iso / Examples / Chapter 14 / Example 14.1 / Debug / Shaders / effect.vs < prev    next >
Encoding:
Text File  |  2006-06-23  |  1.1 KB  |  39 lines

  1. //////////////////////////////////////////////////////////////////////////
  2. //                                                                      //
  3. //                        Effect Vertexshader                           //
  4. //                                                                      //
  5. //                   Written by C. Granberg, 2006                       //
  6. //                                                                      //
  7. //////////////////////////////////////////////////////////////////////////
  8.  
  9. uniform extern float4x4 matW;
  10. uniform extern float4x4 matVP;
  11. uniform extern float4 vertexColor;
  12.  
  13. struct VS_INPUT
  14. {
  15.    float4 position : POSITION0;
  16.    float2 uv : TEXCOORD0;
  17. };
  18.  
  19. struct VS_OUTPUT
  20. {
  21.    float4 position : POSITION0;
  22.    float4 color : COLOR0;
  23.    float2 uv : TEXCOORD0;
  24. };
  25.  
  26. VS_OUTPUT Main(VS_INPUT input)
  27. {
  28.    VS_OUTPUT output = (VS_OUTPUT)0;
  29.  
  30.    // Project position homogeneous clip space.
  31.    float4 temp = mul(input.position, matW);
  32.    output.position = mul(temp, matVP);
  33.    output.uv = input.uv;
  34.    output.color = vertexColor;
  35.  
  36.    return output;
  37. }
  38.  
  39.